﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MealBooking.Core.Models.Accounts;
using MealBooking.Core.Services.Interface;
using Microsoft.Practices.ServiceLocation;
using MealBooking.Core.Models.Orders;

namespace MealBooking.Core
{
    public static partial class CoreService
    {
        public static class AccountService
        {
            #region private
            private static IAccountService GetInstance()
            {
                return ServiceLocator.Current.GetInstance<IAccountService>();
            }
            #endregion

            #region Account
            public static List<Account> AllAccounts()
            {
                return GetInstance().AllAccounts();
            }
            public static Account AccountDetail(Account account)
            {
                return GetInstance().AccountDetail(account);
            }
            public static Account UpdateAccount(Account newAccount)
            {
                return GetInstance().UpdateAccount(newAccount);
            }
            public static Account ValidateUser(string userName, string password)
            {
                return GetInstance().ValidateUser(userName, password);
            }
            public static bool ChangePassword(string accountId, string oldPassword, string newPassword)
            {
                return GetInstance().ChangePassword(accountId, oldPassword, newPassword);
            }
            public static bool ChangeRoles(string accountId, int newRoles)
            {
                return GetInstance().ChangeRoles(accountId, newRoles);
            }
            public static Account RegisterNewAccount(Account newAccount)
            {
                return GetInstance().RegisterNewAccount(newAccount);
            }
            #endregion

            #region Customer
            public static Customer CustomerDetail(string accountId)
            {
                return GetInstance().CustomerDetail(accountId);
            }
            public static void PurchaseBookedOrders(List<Order> orders)
            {
                GetInstance().PurchaseBookedOrders(orders);
            }
            #endregion

            #region balance
            public static List<BalanceHistory> BalanceHistory(string accountId)
            {
                return GetInstance().BalanceHistory(accountId);
            }
            public static void AddBalance(BalanceHistory balanceHistory)
            {
                GetInstance().AddBalance(balanceHistory);
            }
            #endregion

            #region Manager
            public static List<Manager> AllManagerInformations()
            {
                return GetInstance().AllManagers();
            }
            public static Manager ManagerDetail(string accountId)
            {
                return GetInstance().ManagerDetail(accountId);
            }
            #endregion
        }
    }
}
